]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/keyboard: Reset menuItems and Label objects on change
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Sat, 28 Oct 2017 07:23:02 +0000 (02:23 -0500)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 21 Nov 2017 07:16:38 +0000 (02:16 -0500)
In the current code it could happen that we've menuItems and indicatorLabels
for sources that aren't anymore around, because in case a source is removed
we don't cleanup the their container objects.
Also, we should nullify InputManager's _currentSource when sources change
or it might point to some invalid data again.

So it could happen that we try to access an invalid menuitem or label
if a source change happens mentioning a source that has been deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=788931

js/ui/status/keyboard.js

index 70e6abf87c4b30a1ef69701ea212f6b623aca007..b2f10322d18b5faabc18f561190c5c718544fc8e 100644 (file)
@@ -529,6 +529,7 @@ var InputSourceManager = new Lang.Class({
         let sources = this._settings.inputSources;
         let nSources = sources.length;
 
+        this._currentSource = null;
         this._inputSources = {};
         this._ibusSources = {};
 
@@ -827,6 +828,9 @@ var InputSourceIndicator = new Lang.Class({
         for (let i in this._indicatorLabels)
             this._indicatorLabels[i].destroy();
 
+        this._menuItems = {};
+        this._indicatorLabels = {};
+
         let menuIndex = 0;
         for (let i in this._inputSourceManager.inputSources) {
             let is = this._inputSourceManager.inputSources[i];